//
//  NetWorkViewController.m
//  BaseTools
//
//  Created by 李挺哲 on 15/12/9.
//  Copyright © 2015年 ltz. All rights reserved.
//

#import "NetWorkViewController.h"
#import "HttpRequsetViewController.h"
#import "SoapViewController.h"
@interface NetWorkViewController ()
{
    NSMutableArray * array;
    HttpRequsetViewController *httpReqVc;
    UIViewController * socketViewController;
    SoapViewController *  soapViewController;
}
@end

@implementation NetWorkViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavigationTitle:@"网络相关" barTintColor:0x1E86CB titleColor:0xFFFFFF isTranslucent:NO isHidden:NO];
    [self showNavigationLeftButtonTitle:@"返回" tintColor:0xFFFFFF];
    
    array=[NSMutableArray array];
    [array addObject:@"HTTP请求"];
    [array addObject:@"Socket"];
    [array addObject:@"SOAP协议"];
    [array addObject:@"断点续传"];
    UIStoryboard *story = [UIStoryboard  storyboardWithName:@"Main"  bundle:nil];
    httpReqVc=[story instantiateViewControllerWithIdentifier:@"HttpRequsetViewController"];
    UIStoryboard *story2 = [UIStoryboard  storyboardWithName:@"SecondStoryboard"  bundle:nil];
    
    socketViewController=[story2 instantiateViewControllerWithIdentifier:@"Socket"];
    soapViewController=[story2 instantiateViewControllerWithIdentifier:@"SoapViewController"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    
    return array.count;
    
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *reuseId = @"NetWorkTableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId];
    }
    cell.textLabel.textAlignment=NSTextAlignmentCenter;
    cell.textLabel.text=array[indexPath.row];
    return cell;
    
    
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row) {
        case 0:
            
            [self showViewController:httpReqVc sender:self];
            
            break;
            
        case 1:
            [self showViewController:socketViewController sender:self];
            
            
            break;
        case 2:
            
            [self showViewController:soapViewController sender:self];
            
            break;
            
        default:
            
            break;
    }
    
}
@end


